package com.ruoyi.car.controller.parts;

import com.car.pojo.Result;
import com.car.pojo.TbPartSim;
import com.ruoyi.car.service.parts.ITbPartSimService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * sim卡信息模块
 */
@Controller
@RequestMapping("/sim")
public class TbPartSimController extends BaseController {


    @Autowired
    private ITbPartSimService tbPartSimService;

    private String prefix = "system/carparts/sim";

    @RequiresPermissions("part:sim:view")
    @GetMapping()
    public String sim(){
        return prefix +"/sim";
    }

    /**
     * sim列表页面
     * @param tbPartSim
     * @return
     */
    @ResponseBody
    @PostMapping("/partSimList")
    public TableDataInfo partSimList(TbPartSim tbPartSim){
        startPage();
        List<TbPartSim> tbPartSims = this.tbPartSimService.partSimList(tbPartSim);
        return getDataTable(tbPartSims);
    }
    /**
     * 跳转到添加页面
     * @return
     */
    @GetMapping("/add")
    public String add(){
        return prefix + "/add";
    }

    @PostMapping("/partSimInsert")
    @ResponseBody
    public void partSimInsert(TbPartSim tbPartSim){
        this.tbPartSimService.partSimInsert(tbPartSim);
    }
}
